﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WF.DAL;

namespace WF.Model
{
    /// <summary>
    /// SystemSetting实体对象
    /// </summary>
    [Serializable]
    public class SystemSettingEntity : EntityBase<SystemSetting>
    {
        #region 构造函数

        public SystemSettingEntity() : base() { }
        public SystemSettingEntity(SystemSetting obj) : base(obj) { }
        #endregion

        #region 实现基类abstract属性

        public override string ID
        {
            get
            {
                return DbEntity.RowID;
            }
            set
            {
                DbEntity.RowID = value; this.SendPropertyChanged("RowID");
            }
        }

        public override string DisplayName
        {
            get { return DbEntity.ParamName; }
        }

        #endregion

        #region  Public 属性

        public string Name
        {
            get
            {
                return DbEntity.ParamName;
            }
            set
            {
                DbEntity.ParamName = value; this.SendPropertyChanged("ParamName");
            }
        }

        public string ParamValue
        {
            get
            {
                return DbEntity.ParamValue;
            }
            set
            {
                DbEntity.ParamValue = value; this.SendPropertyChanged("ParamValue");
            }
        }

        public string ParamDesc
        {
            get
            {
                return DbEntity.ParamDesc;
            }
            set
            {
                DbEntity.ParamDesc = value; this.SendPropertyChanged("ParamDesc");
            }
        }

        public DateTime? ModDate
        {
            get
            {
                return DbEntity.ModDate;
            }
            set
            {
                DbEntity.ModDate = value; this.SendPropertyChanged("ModDate");
            }
        }
        #endregion

        /// <summary>
        /// 从数据库对象创建逻辑对象
        /// </summary>
        /// <param name="systemSetting">数据库对象</param>
        /// <returns>逻辑对象</returns>
        [Obsolete("请使用 new SystemSettingEntity(systemSetting) ")]
        public static SystemSettingEntity CreateEntityFromDb(SystemSetting systemSetting)
        {
            if (null == systemSetting) return null;
            SystemSettingEntity ret = new SystemSettingEntity(systemSetting);
            return ret;
        }

        //#region IEntity
        //public bool Add(WF.IDataLayer DataLayer)
        //{
        //    return DataLayer.Add(this);
        //}

        //public bool Update(WF.IDataLayer DataLayer)
        //{
        //    return DataLayer.Update(this);
        //}

        //public bool Delete(WF.IDataLayer DataLayer)
        //{
        //    return DataLayer.DeleteSystemSettingEntity(this.ID);
        //}

        //public bool GetDetail(WF.IDataLayer DataLayer)
        //{
        //    SystemSettingEntity result;
        //    if (!DataLayer.GetSystemSettingEntityById(this.ID, out result))
        //    {
        //        return false;
        //    }
        //    this._DALObject = result._DALObject;
        //    return true;
        //}
        //#endregion
    }
}
